<template>
  <div id="map"></div>
</template>

<script>
import { onMounted } from 'vue';
import L from 'leaflet';
import 'leaflet/dist/leaflet.css';
export default {
  setup() {
    onMounted(() => {
      const map = L.map('map', {
        minZoom: 3,
        maxZoom: 16,
        center: [32.065386, 118.802709],
        zoom: 5,
        zoomControl: false,
        attributionControl: false,
        crs: L.CRS.EPSG3857
      });
      const url = 'http://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}';
      const topLayer = L.tileLayer(url, {
        maxZoom: 16,
        attribution: 'Hello world'
      })
      topLayer.addTo(map);
    })
  }
}
</script>

<style lang="less" scoped>
  #map {
    width: 100vw;
    height: 100vh;
  }
</style>